package com.yl.danmo.controller;

import com.yl.common.core.utils.poi.ExcelUtil;
import com.yl.common.core.web.controller.BaseController;
import com.yl.common.core.web.domain.AjaxResult;
import com.yl.common.core.web.page.TableDataInfo;
import com.yl.common.log.annotation.Log;
import com.yl.common.log.enums.BusinessType;
import com.yl.common.security.annotation.RequiresPermissions;
import com.yl.danmo.domain.DanmoPersonInfo1;
import com.yl.danmo.service.IDanmoPersonInfo1Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.io.IOException;

/**
 * 会员详情1Controller
 * 
 * @author yl
 * @date 2025-04-12
 */
@RestController
@RequestMapping("/personInfo1")
public class DanmoPersonInfo1Controller extends BaseController
{
    @Autowired
    private IDanmoPersonInfo1Service danmoPersonInfo1Service;

    /**
     * 查询会员详情1列表
     */
    @RequiresPermissions("system:personInfo1:list")
    @GetMapping("/list")
    public TableDataInfo list(DanmoPersonInfo1 danmoPersonInfo1)
    {
        startPage();
        List<DanmoPersonInfo1> list = danmoPersonInfo1Service.selectDanmoPersonInfo1List(danmoPersonInfo1);
        return getDataTable(list);
    }

    /**
     * 导出会员详情1列表
     */
    @RequiresPermissions("system:personInfo1:export")
    @Log(title = "会员详情1", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DanmoPersonInfo1 danmoPersonInfo1)
    {
        List<DanmoPersonInfo1> list = danmoPersonInfo1Service.selectDanmoPersonInfo1List(danmoPersonInfo1);
        ExcelUtil<DanmoPersonInfo1> util = new ExcelUtil<DanmoPersonInfo1>(DanmoPersonInfo1.class);
        util.exportExcel(response, list, "会员详情1数据");
    }

    /**
     * 获取会员详情1详细信息
     */
    @RequiresPermissions("system:personInfo1:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(danmoPersonInfo1Service.selectDanmoPersonInfo1ById(id));
    }

    /**
     * 新增会员详情1
     */
    @RequiresPermissions("system:personInfo1:add")
    @Log(title = "会员详情1", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DanmoPersonInfo1 danmoPersonInfo1)
    {
        return toAjax(danmoPersonInfo1Service.insertDanmoPersonInfo1(danmoPersonInfo1));
    }

    /**
     * 修改会员详情1
     */
    @RequiresPermissions("system:personInfo1:edit")
    @Log(title = "会员详情1", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DanmoPersonInfo1 danmoPersonInfo1)
    {
        return toAjax(danmoPersonInfo1Service.updateDanmoPersonInfo1(danmoPersonInfo1));
    }

    /**
     * 删除会员详情1
     */
    @RequiresPermissions("system:personInfo1:remove")
    @Log(title = "会员详情1", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(danmoPersonInfo1Service.deleteDanmoPersonInfo1ByIds(ids));
    }
}
